package com.yonyou.pmclouds.basecom.conf;

import com.yonyou.pmclouds.basecom.filter.ThreadClearFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

import javax.servlet.Filter;
import java.util.Arrays;

@Configuration
public class PMContextConfiguration {
    @Bean
    public FilterRegistrationBean contextClearFilter() {
        Filter filter = new ThreadClearFilter();
        FilterRegistrationBean bean = new FilterRegistrationBean(filter);
        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
        bean.setUrlPatterns(Arrays.asList("/*"));
        return bean;
    }

}
